const http = require('http')
const express = require('express')
const app = express()
const cors = require('cors')
const server = http.createServer(app)

app.use(express.json())       // 注册json内置组件
app.use(express.urlencoded({ extended: false }))     // 注册解析表单中的url-encoded数据
app.use(cors())   // 解决同源策略

require('./websocket')(server)

server.listen(3000, () => {
    console.log('listening on *:3000')
})